﻿using System.Web.Routing;
using Nb.Common.Configurations;

namespace Nb.Common.Themes.Providers
{
    internal class ConfigThemeProvider : IThemeProvider
    {
        private const string ThemeConfigKey = "Theme";
        private const string DefaultThemeValue = "Default";

        public Theme GetTheme(RequestContext requestContext)
        {
            var themeValue = ConfigHelper.GetAppSettingValue(ThemeConfigKey, DefaultThemeValue);
            var themeResult = new Theme { Priority = 1, Name = themeValue, Provider = "ConfigThemeProvider" };
            return themeResult;
        }

        public int Priority {
            get { return Theme.DefaultPriority + 1; }
        }
    }
}
